import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const files = require.context("./modules", false, /\.js$/);
let modules = {
    state: {
        tabbarList: [
            {
                id: 0,
                iconPath:
                    "https://aliyundb.mnhes.com/image/default/616B810A9EE84A70AF70048E77757B25-6-2.png",
                selectedIconPath:
                    "https://aliyundb.mnhes.com/image/default/1F204CBB61684C0EBAA581ADDC06E96A-6-2.png",
                text: "首页",
                // midButton: true,
                pagePath: "/pages/home/index",
            },
            {
                id: 1,
                iconPath:
                    "https://aliyundb.mnhes.com/image/default/BB239D3C5F96434FBA68A71965A938F6-6-2.png",
                selectedIconPath:
                    "https://aliyundb.mnhes.com/image/default/D58D396FB2A94BB78B523B071953FC1D-6-2.png",
                text: "课程",
                pagePath: "/pages/course/index",
            },
            {
                id: 2,
                iconPath:
                    "https://aliyundb.mnhes.com/image/default/AD7CA4BF19604011A3D7E57E4C56980A-6-2.png",
                selectedIconPath:
                    "https://aliyundb.mnhes.com/image/default/BFAF6E61B24642EFAE3BFBEC3C6991DA-6-2.png",
                text: "机构",
                pagePath: "/pages/institution/index",
            },
            {
                id: 3,
                iconPath:
                    "https://aliyundb.mnhes.com/image/default/FC2F8B479716411D99C09FCCA34939A7-6-2.png",
                selectedIconPath:
                    "https://aliyundb.mnhes.com/image/default/4303F89A733F4F18B8A84033F1DE4078-6-2.png",
                text: "我的",
                pagePath: "/pages/my/index",
            },
        ],
    },
    mutations: {},
    actions: {},
    getters: {},
};

files.keys().forEach((key) => {
  Object.assign(modules.state, files(key)["state"] || {});
  Object.assign(modules.mutations, files(key)["mutations"] || {});
  Object.assign(modules.actions, files(key)["actions"] || {});
  Object.assign(modules.getters, files(key)["getters"] || {});
});
const store = new Vuex.Store(modules);
export default store;
